<%@ page contentType="text/html; charset=UTF-8" errorPage="/base/jsp/common/CommonError.jsp"%>
<%@taglib prefix="h" uri="/bdp-html" %>
<%@taglib prefix="bdp" uri="/bdp-base" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/base/jsp/common/CommonListTop.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统管理-用户管理</title>
<link href="${ctx}/base/css/base.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/base/css/common.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/base/css/${customTheme}.css" rel="stylesheet" type="text/css" />

<script src="${ctx}/base/js/jquery/jquery.js" type="text/javascript"></script>
<script src="${ctx}/base/js/base.js" type="text/javascript"></script>
<script src="${ctx}/base/js/common/FormFunction.js" type="text/javascript"></script>
</head>

<body class="rightBody">
<form name="searchForm" method="post" action="">
<table width="100%" class="title" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th><img src="${ctx}/base/images/public/titleicon.gif" width="16" height="16" alt="图标 " class="icon" />用户管理</th>
    <th width="140"><!-- a href="defaultEvent('titleControl')" class="titletooffbtn" title="收起">收起搜索</a --></th>
  </tr>
  <tr>
	<td><span class="fl lh200">用户名称：</span><s:textfield name="searchValue['name']" cssClass="input"/>
	    <input type="button" value="搜索" class="btnSo ml5" onclick="defaultEvent('search')"/>
        <input name="" type="reset" value="重置" class="btn2" />
	</td>
  </tr>
</table>
<!--搜索 end-->
<h:table>
	<s:if test="selectType=='multi'">
	    <h:column headerTitle="选择" align="center" width="32">
		    <input type="checkbox" name="selectedRow" value="<s:if test="returnType=='person'"><s:property value="person.id"/></s:if><s:else><s:property value="id"/></s:else>" onClick="parent.checkStaff(this,'<s:property value="name"/>')">
	    </h:column>
	</s:if>
	<s:if test="selectType=='single'">
		<h:column headerTitle="选择" align="center" width="32">
			<input type="radio" name="selectedRow" value="<s:if test="returnType=='person'"><s:property value="person.id"/></s:if><s:else><s:property value="id"/></s:else>" onClick="parent.checkStaff(this,'<s:property value="name"/>')">
		</h:column>
	</s:if>
	<h:column headerTitle="用户名称" width="100">
		<a href="javascript:FormFunction.viewSingle('<s:property value="id"/>',null,750,500);"><s:property value="name"/></a>
	</h:column>
	<h:column headerTitle="所在组"><s:property value="organization.name"/></h:column>
	<h:column headerTitle="联系电话"><s:property value="homeTel" /></h:column>
</h:table>
<!--列表 end-->
<table width="100%" class="pageDown" border="0" cellspacing="0" cellpadding="0">
  <tr><td align="right"><h:pager/>&nbsp;</td></tr>
</table>
</form>
<script>
    var listUrl = "${ctx}/sys/staffSelect!listStaff.action?selectType=<s:property value="selectType"/>&returnType=<s:property value="returnType"/>&orgId=<s:property value='orgId'/>";
	var viewUrl = "${ctx}/sys/staff!viewStaff.action?orgId=<s:property value="orgId"/>";
	/**
	*所有按钮JS函数的入口
	*
	*/
	function defaultEvent(eventType,width,height) {
		FormFunction.defaultEvent(eventType,width,height);
	}
	
	$(document).ready(function() {
	    var selectedStaff = parent.document.getElementById("selectedStaff").value;
	    
	    <s:if test="selectType=='multi'">
	    var selectedArray = selectedStaff.split(",");
	    $("input[type=checkbox][name=selectedRow]").each(function(i,v){
		    var val = $(v).attr("value");
		    for(var count=0; count<selectedArray.length; count++){
			    if(selectedArray[count] && val == selectedArray[count]){
				    $(v).attr("checked", true);
				    break;
			    }
		    }
	    });
	    </s:if>
	    <s:if test="selectType=='single'">
	    $("input[type=radio][name=selectedRow]").each(function(i,v){
		    var val = $(v).attr("value");
		    if(selectedStaff && val == selectedStaff){
			    $(v).attr("checked", true);
		    }
	    });
	    </s:if>
    });
</script>
<%@ include file="/base/jsp/common/CommonListFoot.jsp"%>
</body>
</html>
